Skip to content

Spaces - Client NP Migration, Phase 1#40856

Merged
legrego merged 66 commits into
elastic:masterfrom
legrego:np/spaces-nav-control
Dec 16, 2019
Merged

Spaces - Client NP Migration, Phase 1#40856
legrego merged 66 commits into
elastic:masterfrom
legrego:np/spaces-nav-control

Conversation

@legrego
Copy link
Copy Markdown
Member

@legrego legrego commented Jul 11, 2019

Summary

This introduces a shim in the client-side spaces plugin to start migrating to the new platform.

This PR uses the following NP core/plugin services:

  • Chrome Nav Control
  • Feature Catalogue Registry

This PR also performs some ancillary cleanup/prep work for when the rest of the plugin is able to migrate:

  • Introduce NP "Plugin" in legacy world
  • Migrate Chrome Nav Control to NP
  • Remove SpacesNavState, an unnecessary angular service
  • Update SpacesManager to use NP dependencies (http and notifications)
  • Initialize SpacesManager once within NP, consume single instance everywhere
  • Remove almost all injected variables, replace with private API calls
  • Replace usages of ui/capabilities with the NP equivalent
  • Migrate Feature Catalogue Registration to NP

Resolves #46255

Out of scope

  • Management screens - ⛔️ blocked: relies on legacy Kibana plugin/uiExports
  • Space selector screen door - ⛔️ blocked: relies on legacy Kibana for rendering hidden apps

@elasticmachine

This comment has been minimized.

@elasticmachine

This comment has been minimized.

spacesEnabled,
};

if (spacesEnabled) {
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

stray code, was not being used in TememetryForm component

@elasticmachine

This comment has been minimized.

@elasticmachine

This comment has been minimized.

@elasticmachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

@elasticmachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

@elasticmachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

Comment thread x-pack/legacy/plugins/spaces/server/routes/api/v1/spaces.ts Outdated
import { SpaceCards } from '../components/space_cards';

interface Props {
spaces?: Space[];
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this.props.spaces was provided, it was via injected variables, which have been removed as part of this PR. Now, the selector screen must request the list of spaces on mount.

);
};

private rendePlaceholderMenuItem = (key: string | number): JSX.Element => {
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not strictly required as part of this migration, but it makes for a better user experience when loading the list of available spaces. We often take the near-immediate responses for granted when running locally, and forget that these things can take a noticeable amount of time when hosted in the real world.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

++, it actually looks very nice (testing with throttled network connection) 👍

Suggested change
private rendePlaceholderMenuItem = (key: string | number): JSX.Element => {
private rendePlaceholderMenuItem = (key: string | number) => {

@legrego legrego added Feature:New Platform Feature:Security/Spaces Platform Security - Spaces feature release_note:skip Skip the PR/issue when compiling release notes Team:Security Platform Security: Auth, Users, Roles, Spaces, Audit Logging, etc t// labels Jul 12, 2019
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/kibana-security

@elasticmachine
Copy link
Copy Markdown
Contributor

💔 Build Failed

@legrego
Copy link
Copy Markdown
Member Author

legrego commented Jul 12, 2019

retest

@legrego
Copy link
Copy Markdown
Member Author

legrego commented Dec 10, 2019

@afgomez thanks so much for testing and leaving feedback!

I updated the hook locally to return string | undefined, but the fallout from that cascades throughout the app, to the point where I'm not comfortable making the changes on my own (or as part of this PR)

I'll give this some more thought, but I'm learning towards re-introducing the activeSpace injected var to the legacy platform so that you can continue to consume this as-is, but then your migration to the NP will potentially require you to handle the space id arriving in an async manner.

@afgomez
Copy link
Copy Markdown
Contributor

afgomez commented Dec 11, 2019

your migration to the NP will potentially require you to handle the space id arriving in an async manner.

@legrego that should be OK. We will take it into account :)

Thanks!

@legrego
Copy link
Copy Markdown
Member Author

legrego commented Dec 11, 2019

@afgomez I restored the original functionality, and the log analysis UI appears to function correctly for me now. Would you mind double-checking for me when you get a chance?

Copy link
Copy Markdown
Contributor

@afgomez afgomez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@legrego thanks for this! I tried again and it works like a charm.

Infra changes LGTM

@legrego legrego requested a review from azasypkin December 12, 2019 19:56
@legrego
Copy link
Copy Markdown
Member Author

legrego commented Dec 13, 2019

@elasticmachine merge upstream

Copy link
Copy Markdown
Contributor

@azasypkin azasypkin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thanks for doing this! I've played with a number of basic Spaces related operations - everything worked as expected.

@legrego
Copy link
Copy Markdown
Member Author

legrego commented Dec 16, 2019

@elasticmachine merge upstream

@elasticmachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@legrego legrego added the v7.6.0 label Dec 16, 2019
@legrego legrego merged commit fcdaed9 into elastic:master Dec 16, 2019
@legrego legrego deleted the np/spaces-nav-control branch December 16, 2019 13:31
legrego added a commit that referenced this pull request Dec 16, 2019
* Spaces - Client NP Migration, Phase 1 (#40856)

* shimming NP for spaces client-side plugin

* refresh active space in nav control when updated

* fix advanced settings screen

* allow npStart from unauthed routes

* use NP for deriving space management url

* remove security's usage of SpacesManager

* remove usages of ui/capabilities

* fix tests

* implement NP plugin interface

* remove hack in favor of convention in migration guide

* shim feature catalogue registration

* streamline nav control, and handle async loading more gracefully

* adding opaqueId

* fixes from merge

* fix merge from master

* fixing merge from master

* move _active_space route to NP

* moving to the NP feature catalogue registry

* moving setup to setup phase

* optimizing active space retrieval

* reverting test isolation change

* Apply suggestions from code review

Co-Authored-By: Aleh Zasypkin <aleh.zasypkin@gmail.com>

* removing unnecessary PluginInitializerContext

* updating advanced settings subtitle

* using NP anonymousPaths service

* additional nav_control_popover cleanup

* additional cleanup

* testing out onActiveSpaceChange$ property

* make the linter happy

* make the type checker happy

* fixing types

* fix merge from master

* spaces LP init should run on all pages, not just the kibana app

* address nits

* fix infra/logs, and the spaces disabled scenario

* fix typescript errors

* revert changes to infra plugin

* reintroducing activeSpace injected var for legacy plugins

* fixing react deprecation warning and unhandled promise rejection

* restore activeSpace default var

* spaces does not need to check its own enabled status

* fix from merge

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>

* fix backport merge
brianseeders added a commit to brianseeders/kibana that referenced this pull request Dec 17, 2019
patrykkopycinski pushed a commit to patrykkopycinski/kibana that referenced this pull request May 6, 2026
* shimming NP for spaces client-side plugin

* refresh active space in nav control when updated

* fix advanced settings screen

* allow npStart from unauthed routes

* use NP for deriving space management url

* remove security's usage of SpacesManager

* remove usages of ui/capabilities

* fix tests

* implement NP plugin interface

* remove hack in favor of convention in migration guide

* shim feature catalogue registration

* streamline nav control, and handle async loading more gracefully

* adding opaqueId

* fixes from merge

* fix merge from master

* fixing merge from master

* move _active_space route to NP

* moving to the NP feature catalogue registry

* moving setup to setup phase

* optimizing active space retrieval

* reverting test isolation change

* Apply suggestions from code review

Co-Authored-By: Aleh Zasypkin <aleh.zasypkin@gmail.com>

* removing unnecessary PluginInitializerContext

* updating advanced settings subtitle

* using NP anonymousPaths service

* additional nav_control_popover cleanup

* additional cleanup

* testing out onActiveSpaceChange$ property

* make the linter happy

* make the type checker happy

* fixing types

* fix merge from master

* spaces LP init should run on all pages, not just the kibana app

* address nits

* fix infra/logs, and the spaces disabled scenario

* fix typescript errors

* revert changes to infra plugin

* reintroducing activeSpace injected var for legacy plugins

* fixing react deprecation warning and unhandled promise rejection

* restore activeSpace default var

* spaces does not need to check its own enabled status

* fix from merge


Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature:NP Migration Feature:Security/Spaces Platform Security - Spaces feature release_note:skip Skip the PR/issue when compiling release notes Team:Security Platform Security: Auth, Users, Roles, Spaces, Audit Logging, etc t// v7.6.0 v8.0.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Errors with nav control when spaces are disabled

8 participants